﻿Public Class EmanetKalanRaporu
	Inherits ProcessReport

	Public Overrides Sub GenericEvent(ByVal e As ProcessEventArgs)
		Select Case e.EventType
			Case EventType.Initialize
				Start("Emanet kalan raporu", "Alacaklıyı girin.")
				AddText("Alacakli", "Alacaklı", "nl;width=40")
				AddDateRange("Tarih", "nl", YMD(Today.AddYears(-5)), YMD(Today))
			Case EventType.ValidateForm
				Rs = Kasa.EmanetKalanRaporu(Local, Input("Alacakli"), Input("Tarih1"), Input("Tarih2"))
				e.Result = True
			Case EventType.PageHeader
				Report.PrintReportInfo("EMANET KALAN RAPORU", "TARİH : " & DMY(Input("Tarih1")) & "-" & DMY(Input("Tarih2")) & ", ARAMA KRİTERİ : " & Input("Alacakli"))
				Report.SetColumns("Tahsil No.;Tarih;Alacaklı;Toplam Miktar;Kalan Miktar", "1;2;5;2;2", "r;d;l;m;m", "--")
			Case EventType.ReportDetail
				Do Until Rs.EOF
					Report.Print(Rs("tahsilno"), Rs("tahsiltar"), Rs("kime"), Rs("emanmikt"), Rs("emanmikk"))
					Rs.MoveNext()
				Loop
				Report.SetColumns("", "8;2;2", "r;m;m")
				Report.PrintTotal("Toplam : ", Rs.Sum("emanmikt"), Rs.Sum("emanmikk"))
		End Select
	End Sub

End Class
